﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TBlog = Universum.Model.Domain.Blogs.Blog;
namespace Universum.Model.Services.Blog
{
	public interface IBlogService
	{	
		/// <summary>
		/// Gets the blog bassed on the owner
		/// </summary>
		/// <param name="owner">The owner's id</param>
		/// <returns>Returns a blog instance or null</returns>
		TBlog GetBlogByOwner(string owner);
		
		/// <summary>
		/// Creates a new blog for the user
		/// </summary>
		/// <param name="CurrentUsername">The owner of the blog</param>
		TBlog CreateBlog(string owner);
		
		/// <summary>
		/// Saves or updates the blog instance
		/// </summary>
		/// <param name="blog">The blog</param>
		void SaveOrUpdate(TBlog blog);

		/// <summary>
		/// Removes the blog instance
		/// </summary>
		/// <param name="blog">blog</param>		
		void RemoveBlog(Universum.Model.Domain.Blogs.Blog blog);

		/// <summary>
		/// Returns all articles for the corresponding blog id
		/// </summary>
		/// <param name="guid">Blog id</param>
		/// <returns>The number of articles for that id</returns>
		int GetBlogArticlesCountFor(Guid guid);
		/// <summary>
		/// Returns the given number of results for the specified pages
		/// </summary>
		/// <param name="guid"></param>
		/// <param name="fromIndex"></param>
		/// <param name="articlesPerPage"></param>
		/// <returns></returns>
		IList<Universum.Model.Domain.Blogs.BlogArticle> GetBlogArticlesPage(Guid guid, int fromIndex, int articlesPerPage);
		IList<Universum.Model.Domain.Blogs.BlogArticle> GetPublishedBlogArticlesPage(Guid guid, int fromIndex, int articlesPerPage);

		List<Universum.Model.Domain.Blogs.Blog> GetLatestBlogs(int p);

		List<Universum.Model.Domain.Blogs.BlogArticle> GetLatestArticles(int p);

		List<string> GetUsersWithBlogs();
	}
}
